package com.csx.distributed.invoke.rpc.core.common;

import com.csx.distributed.invoke.rpc.core.common.constant.RpcConstants;

import java.io.Serializable;

/**
 * @author cuisongxu
 * @date 2025/9/1 周一 17:34
 */
public class RpcProtocol implements Serializable {

    private static final long serialVersionUID = 5359096060555795690L;

    private short magicNumber = RpcConstants.MAGIC_NUMBER;

    private int contentLength;

    //这个字段其实是RpcInvocation类的字节数组，在RpcInvocation中包含了更多的调用信息，详情见下方介绍
    private byte[] content;

    public RpcProtocol(byte[] content) {
        this.content = content;
        this.contentLength = content.length;
    }

    public RpcProtocol() {

    }

    public short getMagicNumber() {
        return magicNumber;
    }

    public void setMagicNumber(short magicNumber) {
        this.magicNumber = magicNumber;
    }

    public int getContentLength() {
        return contentLength;
    }

    public void setContentLength(int contentLength) {
        this.contentLength = contentLength;
    }

    public byte[] getContent() {
        return content;
    }

    public void setContent(byte[] content) {
        this.content = content;
    }
}
